//
//  SplashScreenViewController.m
//  MK
//
//  Created by Le Quang Vinh on 8/10/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "SplashScreenViewController.h"

@interface SplashScreenViewController ()

@end

@implementation SplashScreenViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // tabBarController
    tabBarController = [[UITabBarController alloc] init];
    
    // homeViewController
    homeViewController = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
    homeViewController.tabBarItem.title = @"Home";
    UINavigationController *ncHome = [[UINavigationController alloc] initWithRootViewController:homeViewController];
    [homeViewController release];
    
    // socialViewController
    socialViewController = [[SocialViewController alloc] initWithNibName:@"SocialViewController" bundle:nil];
    socialViewController.tabBarItem.title = @"Social";
    UINavigationController *ncSocial = [[UINavigationController alloc] initWithRootViewController:socialViewController];
    [socialViewController release];
    
    // newsViewController
    newsViewController = [[NewsViewController alloc] initWithNibName:@"NewsViewController" bundle:nil];
    newsViewController.tabBarItem.title = @"News";
    UINavigationController *ncNews = [[UINavigationController alloc] initWithRootViewController:newsViewController];
    [newsViewController release];
    
    // musicViewController
    musicViewController = [[MusicViewController alloc] initWithNibName:@"MusicViewController" bundle:nil];
    musicViewController.tabBarItem.title = @"Music";
    UINavigationController *ncMusic = [[UINavigationController alloc] initWithRootViewController:musicViewController];
    [musicViewController release];
    
    // linksViewController
    linksViewController = [[LinksViewController alloc] initWithNibName:@"LinksViewController" bundle:nil];
    linksViewController.tabBarItem.title = @"Links";
    UINavigationController *ncLinks = [[UINavigationController alloc] initWithRootViewController:linksViewController];
    [linksViewController release];
    
    infoViewController = [[InfoViewController alloc] initWithNibName:@"InfoViewController" bundle:nil];
    infoViewController.tabBarItem.title = @"Info";
    UINavigationController *ncInfo = [[UINavigationController alloc] initWithRootViewController:infoViewController];
    [infoViewController release];
    
//    tabBarController.viewControllers = controllers;
//    tabBarController.customizableViewControllers = controllers;
//    [tabBarController setSelectedViewController:homeNavigationController];
//    [controllers release];
//    tabBarController.delegate = self;
    
    
    tabBarController.viewControllers = [NSArray arrayWithObjects:ncHome, ncSocial, ncNews, ncMusic, ncLinks, ncInfo, nil];
    tabBarController.moreNavigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
    [ncHome release];
    [ncSocial release];
    [ncNews release];
    [ncMusic release];
    [ncLinks release];
    [ncInfo release];
    
    
    [self.view addSubview:tabBarController.view];
    
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
